//
//  MOSetUpViewCell.m
//  MobileOffice
//
//  Created by 晓 on 2019/5/31.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MOSetUpViewCell.h"

@interface MOSetUpViewCell ()

@property (nonatomic, strong) UIImageView *arrowImageView;

@end

@implementation MOSetUpViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableview {
    static NSString *cellID = @"MOSetUpViewCell";
    MOSetUpViewCell *cell = [tableview dequeueReusableCellWithIdentifier:cellID];
    if(cell == nil) {
        cell = [[MOSetUpViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupCell];
    }
    return self;
}

- (void)setupCell{
    [self addSubview:self.iconImageView];
    [self addSubview:self.titleLabel];
    [self addSubview:self.arrowImageView];
    [self addSubview:self.updatePromptLabel];
}

#pragma mark -懒加载
- (UIImageView *)iconImageView{
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, kHConversions(20), kHConversions(20))];
        _iconImageView.centerY = kHConversions(54)/2;
    }
    return _iconImageView;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_iconImageView.frame) + 13, 0, kWConversions(150), kHConversions(54))];
        _titleLabel.textColor = KFontBlackColor;
        _titleLabel.font = FONT_SIZE(15);
    }
    return _titleLabel;
}

- (UIImageView *)arrowImageView{
    if (!_arrowImageView) {
        _arrowImageView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 17 - 7, 0, 7, 12)];
        _arrowImageView.centerY = kHConversions(54)/2;
        _arrowImageView.image = IMAGE(@"setUp_arrow");
    }
    return _arrowImageView;
}

- (UILabel *)updatePromptLabel{
    if (!_updatePromptLabel) {
        _updatePromptLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(_arrowImageView.frame) - 10 - kWConversions(50), 0, kWConversions(50), kHConversions(13))];
        _updatePromptLabel.hidden = YES;
        _updatePromptLabel.centerY = kHConversions(54)/2;
        _updatePromptLabel.text = @"有新版本";
        _updatePromptLabel.layer.masksToBounds = YES;
        _updatePromptLabel.layer.cornerRadius = kHConversions(13)/2;
        _updatePromptLabel.backgroundColor = KRedColor_FFFF4040;
        _updatePromptLabel.textColor = KWhiteColor;
        _updatePromptLabel.font = FONT_SIZE(8);
        _updatePromptLabel.textAlignment = NSTextAlignmentCenter;
        
    }
    return _updatePromptLabel;
}
@end
